#ifndef _CAR_SERVER_H_
#define _CAR_SERVER_H_

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <termios.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <pthread.h>

/*
    1: 可以有多个串口；
    2: 可以有多个连接，每个链接可有做不同操作，每种连接可配置成不同的链接数量；
    3: 每个连接可有不同的选择(包数据的选择);
*/

typedef union{
    gaei_packet_t gaei;
    mms317_packet_t mms317;
}car_protocol_packet_t;

typedef union hardware_param{
    uart_param_t uart;
}car_hardware_param_t;

//=============================================
class CarAppInterface{
public:
    virtual int ProcessCarDataPacket(char* buf,int length);
    virtual int GetAppDatasToSend(char* buf,int length);
};

class CarSocketApp : CarAppInterface{
public:
    CarSocketApp();
    virtual ~CarSocketApp(){}
};

class CarVirtureKey : CarAppInterface{
public:
    CarVirtureKey();
    virtual ~CarVirtureKey(){}
};

class CarMangerApp{
public:
    CarMangerApp();
    virtual ~CarMangerApp(){}

protected:
    void registerApp(CarAppInterface *app);
    void dispatchPacket();
private:
    int lisent;
    int linkcount;

};





class car_server{
    class uart_device mDev;

};

#endif
